package util.model;

import java.util.HashMap;
import java.util.Map;
import java.util.Observable;

/**
 * Created by yzy on 2021-04-02 10:25
 */
public class ObservablePublisher extends Observable {

    private Map<String, Object> data;

    public void publish(String key, Object val, Object arg){
        data = data==null? new HashMap<>() : data;
        data.put(key, val);

        this.setChanged();
        this.notifyObservers(arg);
    }


    public Map<String, Object> getData() {
        return data;
    }
}
